﻿using MediatR;
using RBAC.Common.Domains.RabbitProject;
using RBAC.Common.Dto;
using RBAC.Common.infrastructures.interfaces;
using RBAC.Enum;

namespace RBAC.api.Application.commond.Provincescitiesandcounties
{
    public class CityHandler:IRequestHandler<CityCommmond, Rulst>
    {

        private readonly IbaseRpository<City> _city;

        public CityHandler(IbaseRpository<City> city)
        {
            _city = city;
        }

        public async Task<Rulst> Handle(CityCommmond request, CancellationToken cancellationToken)
        {
            var list = new Rulst() { Code = (int)Reult.success };



            list.data=_city.Query().Where(x=>x.ProvinceId==request.Pid).ToList();

            return list;
        }
    }
}
